	<!DOCTYPE html>
<html lang="en">
	<head>
		<include file="Index/head" />
		<style type="text/css">
	@media (min-width: 768px){ 
	.col-sm-6{ width: 100%;}
	}
	#big-img-pop-up{ position:fixed; left:35%; top: 40%;}
	#cboxClose{ float: right;}
		</style>
	</head>

	<body>
		<include file="Index/header" />

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>

			<div class="main-container-inner">
				<a class="menu-toggler" id="menu-toggler" href="#">
					<span class="menu-text"></span>
				</a>

				<include file="Index/menu" />
				
				<div class="main-content">
					<include file="Index/nav" />

					<div class="page-content">
						
							<!-- /**
							 * 右侧页面begin
							 */ -->
								<div class="row">
									<div class="col-xs-12">
										<div class="table-header">
											参赛作品列表
										</div>

										<div class="table-responsive">
											<div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
											<div class="row">
											<div class="col-sm-6">
											<div id="sample-table-2_length" class="dataTables_length">

											</div>
											</div>
											<div class="col-sm-6" style="margin-bottom:-20px;">
											<div class="dataTables_filter" id="sample-table-2_filter">
											<label style="float:left;">
											<a href="{:U('Admin/Vote/vote_option_lists',array('vsid' => $vsid,'isconfirm' =>0))}">
												<button class="btn btn-xs btn-danger">
													<i></i>
													未审核
												</button>
											</a>
											</label>
											<label style="float:left;">
											<a href="{:U('Admin/Vote/vote_option_lists',array('vsid' => $vsid,'isconfirm' =>1))}">
												<button class="btn btn-xs btn-danger">
													<i></i>
													已审核
												</button>
											</a>
											</label>
											<label>
											<form action="{:U('Admin/Vote/vote_option_lists')}" method="POST">
											<input type="text" name="vsid" value="{$vsid}" hidden="hidden">
											搜索识别码: <input type="text" name="cash_code" aria-controls="sample-table-2">
											<input type="submit" value="提交">
											</form>
											</label>
											</div>
											</div>
											</div>
											<table id="sample-table-2" class="table table-striped table-bordered table-hover dataTable" aria-describedby="sample-table-2_info">
												<thead>
													<tr role="row">
													<th  role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Domain: activate to sort column ascending" style="width: 100px;">ID</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Price: activate to sort column ascending" >二维码</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Price: activate to sort column ascending" >唯一识别码</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Price: activate to sort column ascending" >用户名</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">创建时间</th>
													<th class="hidden-480" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Status: activate to sort column ascending" style="width:18%;">推荐理由</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">图片</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">投票人数</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">备注</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">显示状态</th>
													<th role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" aria-label="Clicks: activate to sort column ascending">审核状态</th>
													<th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label=""></th></tr>
												</thead>
											<tbody role="alert" aria-live="polite" aria-relevant="all">
											<volist name="list" id="vo">
											<tr class="odd">
												<td class=" ">{$vo.id}</td>
												<td class=" "><img src="{$vo.qrcode_url}" style="height:50px;"></td>
												<td class=" ">{$vo.cash_code}</td>
												<td class="hidden-480 ">{$vo.username}</td>
												<td class=" ">{$vo.ctime|date="Y-m-d H:i:s",###}</td>
												<td class=" ">{$vo.content}</td>
												<td class=" ">
												<volist name="vo.imgs" id="do">
												<!-- <img src="{$do}" style="width:80px; margin-left:10px;"> -->
												<img class="product_img" src="{$do}" style="height:50px;">
												</volist>
												</td>
												<td><a href="{:U('Admin/Vote/vote_record_lists',array('id' => $vo['id']))}">{$vo.vote_count}</a></td>
												<td class="option_comments" comments="{$vo.comments}" vid="{$vo.id}">{$vo.comments}</td>
												<td>
													<if condition="$vo.ishidden eq 0">
													<p class="btn btn-xs btn-danger">
														<i class=""></i>
														显示
													</p>
													</if>
													<if condition="$vo.ishidden eq 1">
													<p class="btn btn-xs btn-success">
														<i class=""></i>
														隐藏
													</p>
													</if>
												</td>
												<td>
													<if condition="$vo.isconfirm eq 0">
													<p class="btn btn-xs btn-danger">
														<i class=""></i>
														未审核
													</p>
													</if>
													<if condition="$vo.isconfirm eq 1">
													<p class="btn btn-xs btn-success">
														<i class=""></i>
														已审核
													</p>
													</if>
												</td>
												<td class=" ">
													<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
														<!-- <a class="blue" href="{:U('Admin/User/user_details')}">
															<i class="icon-zoom-in bigger-130" title="详情"></i>
														</a> -->
														<a href="{:U('Admin/Vote/modify_vote_option',array('id'=> $vo['id'],'vsid' => $vsid,'isconfirm' => $vo['isconfirm']))}">
															<div class="btn-group dropup">
																<button class="btn btn-xs btn-danger">
																	<i class="icon-ok"></i>
																	修改
																</button>
															</div>
														</a>
														<if condition="$vo.ishidden eq 1">
															<a href="javascript:del_vote_option({$vo.id},{$vo.ishidden})">
																<div class="btn-group dropup">
																	<button class="btn btn-xs btn-danger">
																		<i class="icon-ok"></i>
																		显示
																	</button>
																</div>
															</a>
														</if>
														<if condition="$vo.ishidden eq 0">
															<a href="javascript:del_vote_option({$vo.id},{$vo.ishidden})">
																<div class="btn-group dropup">
																	<button class="btn btn-xs btn-success">
																		<i class="icon-bolt"></i>
																		隐藏
																	</button>
																</div>
															</a>
														</if>
														<a href="javascript:delete_vote_option({$vo.id})">
															<div class="btn-group dropup">
																<button class="btn btn-xs btn-danger">
																	<i class="icon-bolt"></i>
																	删除
																</button>
															</div>
														</a>
														<if condition="$vo.isconfirm eq 0">
															<a href="javascript:agree_pass({$vo.id})">
																<div class="btn-group dropup">
																	<button class="btn btn-xs btn-success">
																		<i class="icon-ok"></i>
																		通过
																	</button>
																</div>
															</a>
														</if>

														<!-- <a class="green" href="">
															<i class="icon-pencil bigger-130" title="修改" ></i>
														</a>

														<a class="red" href="javascript:del_vote_option({$vo.id})">
															<i class="icon-trash bigger-130" title="删除" ></i>
														</a> -->
													</div>

													<div class="visible-xs visible-sm hidden-md hidden-lg">
														<div class="inline position-relative">
															<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown">
																<i class="icon-caret-down icon-only bigger-120"></i>
															</button>

															<ul class="dropdown-menu dropdown-only-icon dropdown-yellow pull-right dropdown-caret dropdown-close">
																<li>
																	<a href="#" class="tooltip-info" data-rel="tooltip" data-original-title="View">
																		<span class="blue">
																			<i class="icon-zoom-in bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="#" class="tooltip-success" data-rel="tooltip" title="" data-original-title="Edit">
																		<span class="green">
																			<i class="icon-edit bigger-120"></i>
																		</span>
																	</a>
																</li>

																<li>
																	<a href="#" class="tooltip-error" data-rel="tooltip" title="" data-original-title="Delete">
																		<span class="red">
																			<i class="icon-trash bigger-120"></i>
																		</span>
																	</a>
																</li>
															</ul>
														</div>
													</div>
												</td>
											</tr>
											</volist>
											</tbody>
											</table>
											<div class="row">
												<div class="col-sm-6">
													<div class="dataTables_info" id="sample-table-2_info">Showing 1 to 10 of 23 entries</div>
												</div>
												<div class="col-sm-6">
													<div class="dataTables_paginate paging_bootstrap">
														<ul class="pagination">
														{$show}
														</ul>
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>

							<!-- /**
							 * 右侧页面end
							 */ -->
						<div id="big-img-pop-up">
							<button type="button" id="cboxClose">×</button>
							<img id="big-img" src="" style="width:300px;">
						</div>
					</div><!-- /.page-content -->
				</div>

			</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<include file="Index/footer" />
		<script type="text/javascript">
		function del_vote_option(id,ishidden)
		{

			var now_url = window.location.href;
			var url = "{:U('Admin/Vote/del_vote_option')}";
			var id = id;
			var ishidden = ishidden;
			$.ajax({
				type: 'post',
				url: url,
				data: {id:id,ishidden:ishidden},
				dataType: 'json',
				success: function(data){
					if(data==1){
						window.location.href=now_url;
					}
				}
			});
		}

		function delete_vote_option(id)
		{
			var r = confirm('确定删除该参赛作品?');
			if(r){
				var now_url = window.location.href;
				var url = "{:U('Admin/Vote/delete_vote_option')}";
				var id = id;
				$.ajax({
					type: 'post',
					url: url,
					data: {id:id},
					dataType: 'json',
					success: function(data){
						if(data==1){
							window.location.href=now_url;
						}
					}
				});

			}else{

				return false;
			}
		}


		/**
		 * 通过作品通过审核
		 */
		function agree_pass(id)
		{
			// var now_url = window.location.href;
			var url = "{:U('Admin/Vote/agree_pass')}";
			var id = id;
			$.ajax({
				type: 'post',
				url: url,
				data: {id:id},
				dataType: 'json',
				success: function(data){
					if(data==1){
						window.location.href="{:U('Admin/Vote/vote_option_lists',array('vsid' => $vsid))}";
					}
				}
			});
		}

		/**
		 * 双击将备注变为input
		 */
		$(document).ready(function(){
			$(".option_comments").bind('dblclick',function(){

				var comments = $(this).html();
				var vid = $(this).attr('vid');
				var nhtml = '<input type="text" class="in_comments" onblur="javascript:comment_modify_on_blur('+vid+')" value="'+comments+'">';
				$(this).empty();
				$(this).append(nhtml);
				$(".option_comments").find(".in_comments").removeClass("in_comments_focus");
				$(this).find(".in_comments").addClass("in_comments_focus");
				console.log("add ok");
			});
			// blur
			
			$("#big-img-pop-up").hide();

			/**
			 * 点击产品图弹出大图
			 */
			$(".product_img").bind('click',function(){

				var product_img_src = $(this).attr('src');
				$("#big-img").attr('src',product_img_src);
				$("#big-img-pop-up").show();
			});

			$("#cboxClose").bind('click',function(){

				$("#big-img-pop-up").hide();
			});

		});

		function comment_modify_on_blur(vid)
		{
			var vid = vid;
			var comments = $(".option_comments").find(".in_comments_focus").val();
			var url = "{:U('Admin/Vote/ajax_modify_option_comments')}";
			$.ajax({
				type:'post',
				url:url,
				data:{vid:vid,comments:comments},
				dataType:'json',
				success:function(data){

						var nhtml = data;

						var this_option_comments = $(".in_comments_focus").parent().empty();
						this_option_comments.append(nhtml);
				}
			});

		}


		</script>
	</body>
</html>
